package edu.xhu.behavior.util;

import edu.xhu.api.id.IdClient;
import edu.xhu.common.exception.CustomException;
import edu.xhu.model.common.dtos.ResponseResult;
import edu.xhu.model.common.enums.AppHttpCodeEnum;

public class IdGen {

    public static Long getBehaviorId(IdClient idClient) {
        ResponseResult<?> idRes = idClient.getSnowflakeDistributedId();
        if (!idRes.getCode().equals(AppHttpCodeEnum.SUCCESS.getCode())) {
            throw new CustomException(AppHttpCodeEnum.SERVER_ERROR);
        }
        return (Long) idRes.getData();
    }

}